export const formatTime = (date) => {
  return (
    date[0] +
    "年" +
    date[1] +
    "月" +
    date[2] +
    "日"
  );
};

// 格式化时间戳
export const formatTimeStamp = (timestamp) => {
  const date = new Date(timestamp);
  const year = date.getFullYear();
  const month = date.getMonth() + 1;
  const day = date.getDate();
  const hour = date.getHours();
  const minute = date.getMinutes();
  const second = date.getSeconds();
  return (
    year +
    "-" +
    month +
    "-" +
    day +
    "" +
    hour +
    ":" +
    minute +
    ":" +
    second
  );
};

export const getSeat = (seat) => {
  let message = "";
  const row = Math.floor(seat / 6) + 1;
  const col = seat % 6;
  if (col == 0 || col == 6) {
    message = row - 1 + "排" + "6座";
    return message;
  }
  message = row + "排" + col + "座";
  return message;
};

export const getSeatNumber = (seatLabel) => {
  const match = seatLabel.match(/(\d+)排(\d+)座/);
  if (!match) return null;

  let row = parseInt(match[1]);
  let col = parseInt(match[2]);

  if (col === 6) {
    return (row - 1) * 6 + 6;
  }
  return (row - 1) * 6 + col;
};

